Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughRefactors DSL builders to explicit builders and immutable models; migrates many Parcelable implementations to Changes
Sequence Diagram(s)sequenceDiagram
%% rectangles colored with rgba( ) 0.5 alpha are not used here; focus on interactions
participant UI as Android UI (Dialog / Compose)
participant VM as AppUpdaterViewModel
participant Side as SideEffect Channel
participant DD as DirectDownloadManager
participant Receiver as DownloadFinishedReceiver
UI->>VM: user triggers download or open-store
VM->>Side: emit one-shot DialogScreenStates (DownloadApk / OpenStore / InstallApk / ExecuteErrorCallback)
Side-->>DD: side-effect consumer invokes download/open action
DD->>Receiver: system download enqueued
Receiver->>VM: notify download finished (Downloaded / Failed)
VM->>UI: update persistent screenState (Idle / UpdateInProgress) via screenState StateFlow
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 18
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@app/build.gradle.kts`:
- Around line 36-38: The kotlin {} block requires the Kotlin Android plugin to
be applied; add alias(libs.plugins.jetbrainsKotlinAndroid) to the plugins block
alongside alias(libs.plugins.androidApplication) and
alias(libs.plugins.compose.compiler) so the org.jetbrains.kotlin.android plugin
is applied for the kotlin { jvmToolchain(17) } configuration, and ensure
gradle/libs.versions.toml defines the plugin alias as jetbrainsKotlinAndroid = {
id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } so
libs.plugins.jetbrainsKotlinAndroid resolves.
In `@appupdater/src/main/java/com/pouyaheydari/appupdater/main/dsl/DSLUtils.kt`:
- Around line 13-55: Extract the duplicated builder classes StoreListItemBuilder
and DirectDownloadListItemBuilder into a shared module (e.g., :store or
:dsl-core) and replace the duplicate implementations in the Compose and Fragment
DSL modules with imports from that shared module; update the build system
(module dependency) and package/imports so UpdaterDialogDataBuilder continues to
reference the shared StoreListItemBuilder/DirectDownloadListItemBuilder types
and ensure the shared builders still produce StoreListItem and
DirectDownloadListItem with the same property names (store, title, icon, url)
and build() signatures.
- Around line 14-20: Replace the lateinit store property in StoreListItemBuilder
with a nullable var (store: AppStore? = null) and add explicit validation in
build(): check that store is not null and throw a clear IllegalStateException
(e.g., "StoreListItemBuilder.store must be set") before constructing
StoreListItem; update the build() method to use the validated non-null store
when calling StoreListItem(store = ..., title = title, icon = icon) so callers
get a helpful error instead of UninitializedPropertyAccessException.
In
`@appupdater/src/main/java/com/pouyaheydari/appupdater/main/ui/AppUpdaterDialog.kt`:
- Around line 139-144: Remove the unused sealed variants
DialogScreenStates.Empty, DialogScreenStates.ShowUpdateInProgress, and
DialogScreenStates.HideUpdateInProgress from the sealed interface definition in
DialogScreenStates (delete their enum/variant declarations) and delete the dead
when-branch in AppUpdaterDialog.kt that matches those three cases (the branch
containing the comment "handled by screenState"). After removal, search for any
remaining references to those symbols (e.g., usages in other files or imports)
and clean them up, then run a build to ensure no unresolved references remain.
In
`@appupdater/src/main/java/com/pouyaheydari/appupdater/main/ui/AppUpdaterViewModel.kt`:
- Around line 41-48: In AppUpdaterViewModel where DialogScreenIntents are mapped
to _sideEffect.trySend (for cases like DialogScreenIntents.OnDirectLinkClicked,
OnStoreClicked, OnOpeningStoreFailed producing DialogScreenStates.DownloadApk,
OpenStore, ExecuteErrorCallback), handle the trySend result: inspect the
ChannelResult (use onFailure or check isFailure) and either log the failure
(include a TAG and context such as which DialogScreenState failed) or switch to
calling send() from a coroutine scope for critical events (e.g., DownloadApk) so
failures are not dropped silently.
In
`@appupdater/src/main/java/com/pouyaheydari/appupdater/main/ui/model/UpdaterDialogData.kt`:
- Around line 21-28: UpdaterDialogData was changed to immutable by turning its
public properties (title, description, storeList, directDownloadList,
isForceUpdate, typeface, errorWhileOpeningStoreCallback, theme) into vals, which
is a breaking API change for callers that mutate the instance; restore the
original mutability by making those properties vars again on the
UpdaterDialogData data class (or alternatively provide explicit copy/with or
builder APIs preserving binary compatibility) so existing consumers that set
properties after construction continue to work.
In `@compose/src/main/java/com/pouyaheydari/appupdater/compose/dsl/DSLUtils.kt`:
- Around line 13-19: The builder currently uses lateinit var store which causes
an UninitializedPropertyAccessException if unset; change store to a nullable var
store: AppStore? = null in StoreListItemBuilder and add an explicit validation
in build() (e.g., requireNotNull(store) { "StoreListItemBuilder.store must be
set before build()" }) before constructing and returning StoreListItem (use the
non-null value after validation). This provides a clear error message and avoids
lateinit.
- Around line 24-29: The builder DirectDownloadListItemBuilder currently allows
title and url to remain empty; update build() to validate required fields (title
and url) before constructing DirectDownloadListItem: check that title is not
blank and url is a non-empty/valid string (or matches a simple URL pattern) and
throw a clear IllegalStateException or IllegalArgumentException if validation
fails, so callers get an early, descriptive error instead of creating an invalid
DirectDownloadListItem.
In
`@directdownload/src/main/kotlin/com/pouyaheydari/appupdater/directdownload/data/DirectDownloadListItem.kt`:
- Around line 13-15: The data class DirectDownloadListItem changed its public
properties title and url from var to val which removes setters and is a breaking
API/ABI change; restore compatibility by making the properties mutable again
(use var for title and url on DirectDownloadListItem) so existing consumers and
generated setters remain available, ensuring the public API surface is
unchanged.
In
`@directdownload/src/main/kotlin/com/pouyaheydari/appupdater/directdownload/utils/downloadapk/APKFileProvider.kt`:
- Line 1: The package rename changed the FQCN of the public interface
APKFileProvider and will break downstream imports; restore a temporary
compatibility shim by adding a deprecated typealias named APKFileProvider in the
old package that aliases the new APKFileProvider (so existing imports still
resolve), annotate it with `@Deprecated` with a message pointing to the new
package/FQCN and a ReplaceWith suggestion, and keep the shim for at least one
release before removal to give users time to migrate.
In
`@directdownload/src/main/kotlin/com/pouyaheydari/appupdater/directdownload/utils/downloadapk/DownloadAPKHelper.kt`:
- Line 1: The package rename changed the FQN of checkPermissionsAndDownloadApk
and will break existing consumers; restore a deprecated compatibility wrapper in
the old package by adding a new file in the previous package namespace
(utils.donwloadapk) that declares a public function
checkPermissionsAndDownloadApk annotated `@Deprecated` which simply forwards its
parameters to the relocated implementation (the new
checkPermissionsAndDownloadApk) and re-exports any needed types, and include a
deprecation message pointing callers to the new package and note removal in the
next release.
In `@gradle/libs.versions.toml`:
- Around line 6-7: The agp version declared as agp = "9.1.0" in
libs.versions.toml is invalid; update the agp entry to a real released Android
Gradle Plugin version (for example "2.3.0" or the intended target) by replacing
the value for the agp key, then verify resolution against Maven Central and that
the Gradle wrapper (9.4.0) and Kotlin (kotlin = "2.3.20") remain compatible;
after changing the agp value, run a Gradle sync/build to ensure the plugin
resolves correctly.
In `@README.md`:
- Line 155: Update the two heading lines "Fragment DSL" and "Compose DSL" to use
one-level deeper headings (change from #### to ###) so they correctly follow the
parent "DSL Builders" (which is ##) and comply with MD001; locate the headings
by their exact text ("Fragment DSL" and "Compose DSL") in README.md and replace
the four-hash markers with three-hash markers.
- Line 2: The image tag(s) in README.md are missing alt text; update each <img>
element (e.g., the <img
src="https://raw.githubusercontent.com/HeyPouya/AndroidAppUpdater/master/pics/icon.png"
width="250">) to include a descriptive alt attribute (for example alt="Android
App Updater icon" or equivalent) to satisfy accessibility/MD045 requirements and
apply the same change to the other image(s).
- Around line 314-322: Update the fenced code block that starts with the line
"AndroidAppUpdater/" so the opening triple backticks include a language
identifier (e.g., change ``` to ```text) to satisfy MD040; locate the block
containing the ASCII architecture diagram (the lines showing
"AndroidAppUpdater/" and its subdirectories) and add the identifier to the
opening ``` only.
In
`@store/src/main/java/com/pouyaheydari/appupdater/store/domain/StoreIntentBuilder.kt`:
- Around line 26-28: In Builder.withPackage (the function that sets
storePackageName) the require message has a typo "most" — update the exception
string to read "must not be empty" (i.e., change the require message for
storePackageName in withPackage to "Store's package name must not be empty") so
the validation message is correct; locate the require(...) call in
Builder.withPackage and replace the message accordingly.
In
`@store/src/main/java/com/pouyaheydari/appupdater/store/domain/StoreListItem.kt`:
- Around line 15-18: The default for StoreListItem.icon was changed to 0 which
breaks previews/tests that relied on the previous drawable default; update any
preview/test instantiations of StoreListItem to pass an explicit drawable
resource (e.g., R.drawable.appupdater_ic_cloud or another appropriate drawable)
when constructing StoreListItem, or alternatively revert/change the default in
the StoreListItem declaration; search for usages of StoreListItem in
preview/test files and add the icon argument to each call to restore the
expected icon behavior.
In
`@store/src/main/java/com/pouyaheydari/appupdater/store/domain/stores/NineApps.kt`:
- Around line 4-15: Add the Kotlin Parcelize plugin to every module that uses
`@Parcelize` (modules: store, directdownload, appupdater) so files like NineApps
(class NineApps in NineApps.kt) compile; update each module's Gradle settings to
apply the Kotlin parcelize plugin (the kotlin-parcelize /
org.jetbrains.kotlin.plugin.parcelize plugin) in the plugins block of that
module's build.gradle.kts.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: aa7b2ed7-9ddd-4b2b-bdd4-5aad6589f9cb
📒 Files selected for processing (64)
README.mdapp/build.gradle.ktsappupdater/consumer-rules.proappupdater/src/main/java/com/pouyaheydari/appupdater/main/dsl/DSLUtils.ktappupdater/src/main/java/com/pouyaheydari/appupdater/main/ui/AppUpdaterDialog.ktappupdater/src/main/java/com/pouyaheydari/appupdater/main/ui/AppUpdaterViewModel.ktappupdater/src/main/java/com/pouyaheydari/appupdater/main/ui/adapters/DirectRecyclerAdapter.ktappupdater/src/main/java/com/pouyaheydari/appupdater/main/ui/adapters/StoresRecyclerAdapter.ktappupdater/src/main/java/com/pouyaheydari/appupdater/main/ui/model/UpdaterDialogData.ktappupdater/src/main/java/com/pouyaheydari/appupdater/main/ui/model/UpdaterFragmentModel.ktappupdater/src/main/java/com/pouyaheydari/appupdater/main/utils/ErrorCallbackHolder.ktappupdater/src/test/java/com/pouyaheydari/appupdater/main/ui/AppUpdaterViewModelTest.ktbuild-logic/convention/src/main/java/com/pouyaheydari/appupdater/convention/plugins/AndroidLibraryPlugin.ktbuild.gradle.ktscompose/consumer-rules.procompose/src/main/java/com/pouyaheydari/appupdater/compose/dsl/DSLUtils.ktcompose/src/main/java/com/pouyaheydari/appupdater/compose/ui/AndroidAppUpdaterScreen.ktcompose/src/main/java/com/pouyaheydari/appupdater/compose/ui/AndroidAppUpdaterViewModel.ktcompose/src/main/java/com/pouyaheydari/appupdater/compose/ui/models/UpdaterDialogData.ktdirectdownload/consumer-rules.prodirectdownload/src/main/kotlin/com/pouyaheydari/appupdater/directdownload/data/DirectDownloadListItem.ktdirectdownload/src/main/kotlin/com/pouyaheydari/appupdater/directdownload/domain/DownloadState.ktdirectdownload/src/main/kotlin/com/pouyaheydari/appupdater/directdownload/receiver/DownloadFinishedReceiver.ktdirectdownload/src/main/kotlin/com/pouyaheydari/appupdater/directdownload/utils/downloadapk/APKDownloadManager.ktdirectdownload/src/main/kotlin/com/pouyaheydari/appupdater/directdownload/utils/downloadapk/APKFileProvider.ktdirectdownload/src/main/kotlin/com/pouyaheydari/appupdater/directdownload/utils/downloadapk/APKFileProviderImpl.ktdirectdownload/src/main/kotlin/com/pouyaheydari/appupdater/directdownload/utils/downloadapk/DownloadAPKHelper.ktdirectdownload/src/main/kotlin/com/pouyaheydari/appupdater/directdownload/utils/downloadapk/DownloadManagerRequestCreator.ktdirectdownload/src/main/kotlin/com/pouyaheydari/appupdater/directdownload/utils/permission/DownloadAPKPermissionFactory.ktdirectdownload/src/main/kotlin/com/pouyaheydari/appupdater/directdownload/utils/permission/DownloadAPKPermissionForOAndBelow.ktdirectdownload/src/test/kotlin/com/pouyaheydari/appupdater/directdownload/utils/downloadapk/APKDownloadManagerTest.ktdirectdownload/src/test/kotlin/com/pouyaheydari/appupdater/directdownload/utils/downloadapk/APKFileProviderImplTest.ktdirectdownload/src/test/kotlin/com/pouyaheydari/appupdater/directdownload/utils/downloadapk/DownloadAPKHelperKtTest.ktdirectdownload/src/test/kotlin/com/pouyaheydari/appupdater/directdownload/utils/downloadapk/DownloadManagerRequestCreatorTest.ktdirectdownload/src/test/kotlin/com/pouyaheydari/appupdater/directdownload/utils/permission/DownloadAPKPermissionFactoryTest.ktdirectdownload/src/test/kotlin/com/pouyaheydari/appupdater/directdownload/utils/permission/DownloadAPKPermissionForOAndBelowTest.ktgradle/gradle-daemon-jvm.propertiesgradle/libs.versions.tomlgradle/wrapper/gradle-wrapper.propertiessettings.gradle.ktsstore/consumer-rules.prostore/src/main/java/com/pouyaheydari/appupdater/store/domain/AppStoreCallback.ktstore/src/main/java/com/pouyaheydari/appupdater/store/domain/StoreFactory.ktstore/src/main/java/com/pouyaheydari/appupdater/store/domain/StoreIntentBuilder.ktstore/src/main/java/com/pouyaheydari/appupdater/store/domain/StoreListItem.ktstore/src/main/java/com/pouyaheydari/appupdater/store/domain/StoreManager.ktstore/src/main/java/com/pouyaheydari/appupdater/store/domain/stores/AmazonAppStore.ktstore/src/main/java/com/pouyaheydari/appupdater/store/domain/stores/AppStore.ktstore/src/main/java/com/pouyaheydari/appupdater/store/domain/stores/AppStoreType.ktstore/src/main/java/com/pouyaheydari/appupdater/store/domain/stores/Aptoide.ktstore/src/main/java/com/pouyaheydari/appupdater/store/domain/stores/CafeBazaarStore.ktstore/src/main/java/com/pouyaheydari/appupdater/store/domain/stores/FDroid.ktstore/src/main/java/com/pouyaheydari/appupdater/store/domain/stores/GooglePlayStore.ktstore/src/main/java/com/pouyaheydari/appupdater/store/domain/stores/HuaweiAppGallery.ktstore/src/main/java/com/pouyaheydari/appupdater/store/domain/stores/LenovoAppCenter.ktstore/src/main/java/com/pouyaheydari/appupdater/store/domain/stores/MiGetAppStore.ktstore/src/main/java/com/pouyaheydari/appupdater/store/domain/stores/MyketStore.ktstore/src/main/java/com/pouyaheydari/appupdater/store/domain/stores/NineApps.ktstore/src/main/java/com/pouyaheydari/appupdater/store/domain/stores/OneStoreAppMarket.ktstore/src/main/java/com/pouyaheydari/appupdater/store/domain/stores/OppoAppMarket.ktstore/src/main/java/com/pouyaheydari/appupdater/store/domain/stores/SamsungGalaxyStore.ktstore/src/main/java/com/pouyaheydari/appupdater/store/domain/stores/TencentAppStore.ktstore/src/main/java/com/pouyaheydari/appupdater/store/domain/stores/VAppStore.ktstore/src/main/java/com/pouyaheydari/appupdater/store/domain/stores/ZTEAppCenter.kt
💤 Files with no reviewable changes (1)
- build.gradle.kts
Update Gradle to version 9.4.0, and enhance ProGuard rules
Summary by CodeRabbit